package JavaCore;

public class ArrayTest1 {
	
	public void ex1(){
		
		int[] kor = {10,20,30,40,50};
		int sum=0;
		double avg=0;
		for (int i=0;i<kor.length;i++){
			sum +=kor[i];
		}
		avg = sum/5.0 ;
		System.out.println("sum = " + sum);		
		System.out.println("avg = " + avg);		
	}
	
	public void ex2(){
		
		int[] kor = {10,20,30,40,50};
		int sum=0;
		double avg=0;
		int i=0;
		while(i<kor.length){
			sum+=kor[i];
			i++;
		}
		avg = sum/5.0 ;
		System.out.println("sum = " + sum);		
		System.out.println("avg = " + avg);		
	}

	
	
	public ArrayTest1(){
		
	}

	public static void main(String[] args) {
		ArrayTest1 at = new ArrayTest1();
		
		at.ex1();
		at.ex2();
		

	}

}
